UserTaskMatcher gets tasks with most overlapping skills fixes #736#752
UserTaskMatcher gets tasks with most overlapping skills fixes #736#752ignu wants to merge 1 commit intocode-corps:developfrom
Conversation
joshsmith
left a comment
There was a problem hiding this comment.
This looks really great and is going to be a huge deal if we can combine it with an "unassigned tasks" query. That means we'll be able to suggest tasks to a user automatically via email, and eventually through our in-app messenger, too.
| group_by: t.task_id, | ||
| order_by: count(t.task_id), | ||
| limit: ^tasks_count, | ||
| select: t.task_id |
There was a problem hiding this comment.
Have you been able to run an EXPLAIN on this query by chance to see how well it performs?
| import Ecto.Query | ||
|
|
||
| @spec match_user(User.t, number) :: [Task.t] | ||
| def match_user(%CodeCorps.User{} = user, tasks_count) do |
There was a problem hiding this comment.
Would write some inline documentation here and rename to tasks_limit or something more intention revealing.
| has_many :roles, through: [:role_skills, :role] | ||
|
|
||
| has_many :project_skills, CodeCorps.ProjectSkill | ||
| has_many :user_skills, CodeCorps.UserSkill |
There was a problem hiding this comment.
Can this go last to keep alpha order?
There was a problem hiding this comment.
should roles and role_skills be in alpha order too?
| where: user.id == ^user.id, | ||
| group_by: t.task_id, | ||
| order_by: count(t.task_id), | ||
| limit: ^tasks_count, |
There was a problem hiding this comment.
I actually kind of wonder if we shouldn't do the limit chained elsewhere to keep this function more multipurpose. I.e. Without it we could do a count.
|
|
||
| tasks = match_user(user, 2) | ||
|
|
||
| assert(length(tasks) == 2) |
There was a problem hiding this comment.
You might be able to write this as assert tasks |> length() == 2 instead.
|
|
||
| account_page = insert(:task) | ||
| settings_page = insert(:task) | ||
| photoshop = insert(:task) |
There was a problem hiding this comment.
These could maybe be rethought a little to tell a clearer story. Like one could be front_end_task and one back_end_task and one design_task. You'd have coding_skill and design_skill and then match accordingly. Your final test would be 1 and 3 for length instead, using a limit of 1 and 3.
There was a problem hiding this comment.
This comment probably conflicts slightly with the suggestion to chain, but with the right ordering could be resolvable.
There was a problem hiding this comment.
That's what i was going for with skills that were implementing an entire page (thus needing coding and design) versus one that was just PhotoShop.
I did start to wonder sometimes about using just the most overlapping tasks as the sort priority. I could see someone like me selecting 'design' as a tag (even though that's a stretch). Then I'd get a list of results back that were design heavy, even though I'd be better suited for a task that simply overlaps my strongest skill, coding.
(Seems like this would be more clear when we saw real data instead of speculating what the data would be.)
There was a problem hiding this comment.
Yeah I think this is simply the most naive approach right now. I'd prefer some sort of recommender system generally but we're a ways off from that.
|
Really great work here btw! |
|
That's a good question, what use is this if we don't return just unassigned tasks? |
|
@ignu I can see it being useful in other circumstances, like as a filter for the task board. |
77663d1 to
c5e8228
Compare
|
@ignu just wanted to check on this with you. |
f04a221 to
4d24c1f
Compare
e075407 to
6d6cc63
Compare
What's in this PR?
Add UserTaskManager to return tasks with the most overlapping skills
References
Fixes #736